// packageC/pages/takeoutOrder/takeoutOrder.js
// const QQMapWX = require('../../../libs/qqmap-wx-jssdk1.2/qqmap-wx-jssdk')
const app = getApp()
const common = require('../../../public.js')
Page({
    /**
     * 页面的初始数据
     */
    data: {
        height: '',
        top: '',
        num: 2,
        showOrder: false,
        showCancel: false,
        cansselList: [
            ' 取消订单',
            ' 修改订单信息',
            '狠心取消'
        ],
        word: '',
        address: '地址',
        markers: [{
                latitude: 34.79502,
                longitude: 117.2632,
                iconPath: 'http://feiyangimage.oss-cn-shanghai.aliyuncs.com/activity/1670221277430887.png',
                width: 18,
                height: 18,
                callout: {
                    content: "测试气泡",
                    color: '#000',
                    fontSize: 12,
                    borderWidth: 1,
                    borderRadius: 10,
                    borderColor: '#ccc',
                    bgColor: '#fff',
                    padding: 10,
                    display: 'BYCLICK',
                    textAlign: 'left',
                  },
                // anchor: {
                //     x: 0.4,
                //     y: 0.5
                // }
            },
            {
                latitude:40.817498,
                longitude:111.765617,
                iconPath: 'http://feiyangimage.oss-cn-shanghai.aliyuncs.com/activity/1670221277430887.png',
                width: 18,
                height: 18,
                anchor: {
                    x: 0.45,
                    y: 0.5
                },
                callout: {
                    content: "测试气泡",
                    color: '#000',
                    fontSize: 12,
                    borderWidth: 1,
                    borderRadius: 10,
                    borderColor: '#ccc',
                    bgColor: '#fff',
                    padding: 10,
                    display: 'BYCLICK',
                    textAlign: 'left',
                  },
            }
           
        ],
        polyline:[],
        latitude: '',
        longitude: '',
        windowHeight: '',
        
    },
    // 订单取消
    click_order(e) {
        // console.log(e,"jdjjdjdjjdj")
        let index = e.currentTarget.dataset.item
        if (index == 0) {
            wx.redirectTo({
                url: '/packageC/pages/takeoutCansel/takeoutCansel',
            })
        }
    },
    chooseMap() {
        app.getLocation(
            (data) => {
                console.log(data, "iiiiioooop[p[pp")
                this.setData({
                    longitude: data.longitude,
                    latitude: data.latitude
                }, () => {
                    
                })
            },
            (err) => {
                // 定位失败回调
                this.setData({
                    refreshing: false
                })
            })
    },


    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        this.chooseMap()
        //获取胶囊位置
        let capsule = wx.getMenuButtonBoundingClientRect()
        this.setData({
            height: capsule.height,
            top: capsule.top,
        })

        var windowHeight = wx.getSystemInfoSync().windowHeight
        this.setData({
            windowHeight: (windowHeight - 44) + 'px'
        })

    },
    cancel_order() {

    },
    xiugai_order() {
        this.setData({
            showOrder: true
        });
    },
    onClose() {
        this.setData({
            showOrder: false
        });
    },
    // 查看更多
    click_lenght() {
        this.setData({
            num: 6
        })
    },
    // 修改订单信息
    revise_order() {
        this.setData({
            showOrder: true
        })
    },

})